import request from "@/utils/request";

// 上传图片
export const uploadImage = (formData: FormData) => {
  console.log(formData, "formData");
  return request.post<
    IResponse<{
      imageUrl: string;
      filename: string;
      originalName: string;
      size: number;
      mimetype: string;
    }>
  >("/upload/image", formData, {
    headers: {
      "Content-Type": "multipart/form-data",
    },
  });
};

// 删除图片
export const deleteImage = (filename: string) => {
  return request.delete<IResponse<null>>(`/upload/image/${filename}`);
};
